# -*- coding: utf-8 -*-
"""
file:ch6_1积分定与不定
author: Fuwen
time: 2022/7/16 17:31
software:PyCharm
"""
import numpy as np
import matplotlib.pyplot as plt

# 积分- 求和， 微分- 求无穷小的变化， 互为逆运算， 不定积分， 带常数C
# 原函数f(x) = 0.5*x**2 + x + C

# 函数系数
a = 0.5
b = 1

# 绘制函数图像
for c in range(-5, 6, 5):
    x = np.linspace(-5, 5, 100)
    y = a * x ** 2 + b * x + c
    # 导函数 f = x + 1
    plt.plot(x, y, )

plt.grid()
plt.show()

# sympy 积分函数
from sympy import *

x = Symbol('x')
a = Symbol('a')
f = a * x
F = integrate(f, x)
print('F = ',F)
